{extend name="$_tpl_public_layout_danceadmin"/}


{block name="breadcrumb"}
<ol class="breadcrumb">
	<li class="breadcrumb-item"><a href="{:url('admin/index/index')}">{:config('system.site_title')}</a></li>
	<li class="breadcrumb-item"><a href="{:url('mobmall_manage/user/index')}">{$sideName}</a></li>
</ol>
{/block}


{block name="pageheader"}
{$sideName}
{/block}


{block name="content"}
<div class="card">
	<div class="card-body">
		<form method="post" action="{:url('mobmall_manage/user/doSetShop')}" enctype="multipart/form-data" class="form-horizontal J_ajaxForm">
			<input type="hidden" name="id" value="{$id}" />
			<div class="form-group row">
				<label class="col-md-2 control-label">用户名</label>
				<div class="col-md-5">
					<input type="text" class="form-control" name="data[username]" value="{$info['username']}" disabled="" />
				</div>
				<div class="col-md-5"></div>
			</div>
			<div class="form-group row">
				<label class="col-sm-2 control-label">所属店铺</label>
				<div class="col-sm-5">
					<select id="mySelectShop" name="data[shid]" class="form-control js-data-example-ajax">
						<option value="{$info['shid']}">{$info['shop_name']}</option>
					</select>
				</div>
				<div class="col-sm-5"></div>
			</div>
			<div class="form-group row">
				<label class="col-sm-2 control-label">设置角色组</label>
				<div class="col-sm-5">
					<?php echo selectHtmlB($merchantRoleList, 'data[realrole]', $info['realrole'], 'name', 'id', 'form-control'); ?>
				</div>
				<div class="col-sm-5"></div>
			</div>
			<div class="clearfix form-actions">
				<div class="offset-md-2 col-sm-10">
					<button type="submit" class="btn btn-primary btn-sm J_ajaxSubmit">保存修改</button>
				</div>
			</div>
		</form>
	</div>
</div>
{/block}


{block name="script"}
<!-- select2 -->
<link rel="stylesheet" type="text/css" href="/static/plugins/select2/select2.min.css">
<script type="text/javascript" src="/static/plugins/select2/select2.min.js"></script>
<style type="text/css">
.select2-container .select2-selection--single{height:34px;}
</style>
<script type="text/javascript">
var url_shop = "{:url('mobmall/shopApi/ajaxAssociate')}";
$('#mySelectShop').select2({
	ajax: {
		url: url_shop,
		data: function (params){
			var query = {
				word: params.term,
			}
			// Query parameters will be ?search=[term]&type=public
			return query;
		},
		processResults: function (ret){
			console.log(ret);
			if(ret.code == 1){
				var data = ret.data;
				return {
					results: data.list
				};
			}else if(ret.code == 0){
				Wei.Util.wapTipNew({msg: ret.msg, icon: 2, time: ret.time,});
			}
		}
	}
});
</script>
{/block}